class Solution {
    public int hammingDistance(int x, int y) {
        int ans=0;
        for(int i=x^y;i!=0;i-=i&-i)
            ans++;
        return ans;
    }
}